<template>
  <div>我是a1</div>
  <div>我叫{{ person.name }}</div>
  <div>我今年{{ person.age }}</div>
  <input type="text" v-model="person.age" />
  <div>我的id:{{ person.id }}</div>
  <input type="text" v-model="person.id" />
</template>

<script>
import { reactive, computed } from "vue";
import a1 from "../../02-setup配置/components/a1.vue";
export default {
  components: { a1 },
  setup(props, context) {
    let person = reactive({
      name: "chenkun",
      age: "99",
    });
    // 简写形式，只读
    // person.id = computed(() => {
    //   return person.name + "-" + person.age + "-" + new Date().getTime();
    // });
    person.id = computed({
      get() {
        return person.name + "-" + person.age + "-" + new Date().getTime();
      },
      set(value) {
        person.name = value;
      },
    });
    return { person };
  },
};
</script>

<style>
</style>